package com.wanghua.spring.service;

import com.wanghua.spring.bean.entity.VisitOnline;
import com.wanghua.spring.dao.DaoImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VisitDetailService implements IVisitDetailService {
    @Resource   //Spring注射进来的。这是 JSR-250 规范定义的注释，按 byName 自动注入。
    private DaoImpl dao;

    @Override
    public int removeTimedOutOnlineRecords() {
        return dao.removeTimedOutOnlineRecords();
    }

    @Override
    public void create(Object obj) {
        dao.create(obj);
    }

    @Override
    public void save(Object obj) {
        dao.save(obj);
    }

    @Override
    public VisitOnline findValidOnline(String ip, String userid) {
        return dao.findValidOnline(ip, userid);
    }

    @Override
    public int getTotalCount(String hql) {
        return dao.getTotalCount(hql);
    }

    @Override
    public List list(String hql, int firstResult, int maxResults) {
        return dao.list(hql, firstResult, maxResults);
    }

    public DaoImpl getDao() {
        return dao;
    }

    public void setDao(DaoImpl dao) {
        this.dao = dao;
    }
}
